package com.yanqu.road.server.pb;

import com.yanqu.road.entity.servercenter.LightMsg;
import com.yanqu.road.pb.lightmsg.LightMsgProto;

import java.util.List;

/**
 * @Author wpj
 * @Date 2020/12/23
 */
public class LightPb {

    public static LightMsgProto.LightMsgListMsg.Builder getListMsgList(List<LightMsg> lightMsgList) {
        LightMsgProto.LightMsgListMsg.Builder builder = LightMsgProto.LightMsgListMsg.newBuilder();
        for (LightMsg lightMsg : lightMsgList) {
            builder.addMsg(getListMsgPb(lightMsg));
        }
        return builder;
    }

    public static LightMsgProto.LightMsgTemp.Builder getListMsgPb(LightMsg lightMsg) {
        LightMsgProto.LightMsgTemp.Builder builder = LightMsgProto.LightMsgTemp.newBuilder();
        builder.setMsgId(lightMsg.getMsgId());
        builder.setStartTime(lightMsg.getStartTime());
        builder.setEndTime(lightMsg.getEndTime());
        builder.setContent(lightMsg.getContent());
        builder.setMsgType(lightMsg.getMsgType());
        builder.setSpace(lightMsg.getSpace());
        return builder;
    }
}
